Copyright: This file © Robert R. Jacques 09/08/94


yesyesyesyesyesCODE2WD6.I__001FALSECode2wd6 HelpCode2wd6yesyes08/09/94


Table of Contents

Introduction

Control Definition

Procedure Definition

Declaring Variables

Comments

Benefits of Registration

Registration Form

Installing Code2wd6.Dot

Template Definition

Winword 6.0 User Templates

Initializing Code2wd6.Dot

Changing Initialization File

Code2wd6.ini

Control Structures

Procedures

Declarations

Normal Font

Embedded Keywords

Default Windows Directory

Selecting a File

Binary File

Visual Basic™ Default Settings

Saving Reformatted Code

Printing

Using Different Fonts and Colors

Using the Zoom Command

Sample [Font Settings]

Adapting the Macro to other Structures/Languages

Removing Code2wd6.Dot from your System

User Feedback

Change Code2wd6 Settings

Using Code2wd6 Help

List Box

OK Button

Cancel Button

Help Button

Flashing Title Bar


Help file produced by  HELLLP! v2.3a , a product of Guy Software, on 5:12 PM for Unregistered User.

The above table of contents will be automatically completed and will also provide an excellent cross-reference for context strings and topic titles.  You may leave it as your main table of contents for your help file, or you may create your own and cause it to be displayed instead by using the I button on the toolbar.  This page will not be displayed as a topic.  It is given a context string of _._ and a HelpContextID property of 32517, but these are not presented for jump selection.

HINT:  If you do not wish some of your topics to appear in the table of contents as displayed to your users (you may want them ONLY as PopUps), move the lines with their titles and contexts to below this point.  If you do this remember to move the whole line, not part.  As an alternative, you may wish to set up your own table of contents, see Help under The Structure of a Help File.

  Do not delete any codes in the area above the Table of Contents title, they are used internally by HELLLP!


Introduction

Code2wd6.Dot is a macro template that inserts an existing Visual Basic™ form or code module into a blank Microsoft® Word for Windows 6.0 document.  The module is then reformatted for better screen and printed output.  Code2wd6.Dot uses color and styles to highlight control structures, procedures, declaring variables, and comments.

This template is completely functional with no annoying shareware gimmicks.  We would like you to register the product, but only if the template provides software value.  We do concede that the licensed version provides a more detailed Help module (explained under Benefits of Registration).

Installing Code2wd6.Dot

Initializing Code2wd6.Dot

Changing Code2wd6.Dot

Using Code2wd6.Dot

Selecting a File

Binary Files

Visual Basic™ Default Settings

Saving Reformatted Code

Printing

Helpful Hints

Using Code2wd6 Help

Using Different Fonts and Colors

Using the Zoom Command

Sample [Font Settings] from Code2wd6.ini

Adapting the Macro to other Structures/Languages

Removing Code2wd6.Dot from your System

Registration

User Feedback


Control Definition
A control structure executes a series of statements when a given condition is true.


Procedure Definition
A procedure contains code that is executed when it is called from another procedure or from an event.


Declaring Variables
Declaring variables allow you to store values for use in your procedures.


Comments
Comments are a big part of any programming project.  The macro isolates them from other code and highlights them based on your preferences.


Installing Template
Installing Code2wd6.Dot

The document Code2wd6.Doc contains a setup macro which automatically copies the Code2wd6.Dot Template to your default Word for Windows 6.0 template directory.  Open the document and select the picture of the hard disk and press the Enter key or double-click with the mouse.

If for some reason, the setup routine fails to copy the template to the appropriate directory, you can manually copy Code2wd6.Dot and Code2wd6.Hlp to your default template directory.


Template Definition
A template is a blueprint that helps you to avoid repetitive work.  Code2wd6.Dot has been designed to reformat Visual Basic™ code in a standard way based on your set of font preferences.


Winword 6.0 User Templates
The default Word for Windows 6.0 template directory is the directory that can be accessed through the Tools/Options Menu.  You can find it under the heading File Locations and by selecting the category User Templates.


Initializing Code2wd6.Dot

A file containing your font preferences is accessed every time you run Code2wd6.Dot.   The proper setup of this initialization file is critical for the macro to be of any value to you.  We encourage you to think about the font settings before starting the initialization process.  If you have a color monitor and/or printer, use different colors.  If your system has several installed fonts, use them.  You can also take advantage of other font properties including point size, bold, italics, small caps,  and underlining.  Keep in mind that the macros purpose is to highlight sections of your code for easier reading and debugging.

First Time

To use the template, choose the New command from the File Menu and select Code2wd6.

The first time you use the macro, a dialog box will ask you to create Code2wd6.ini.  This initialization file contains the styles used by the macro for formatting your Visual Basic™ code.  The macro will cycle through the control structures, procedures, declaring variables, and comments and ask you to select an appropriate font setting.  The initialization process also asks you to enter the Normal Font and a font for Embedded Keywords.  These settings will be written to the Code2wd6.ini file in your default windows directory.

Important:  The macro disables the Cancel button from the Font Dialog Box.  A font must be selected.  Once a font has been selected, the macro cycles to the next structure.


Code2wd6.ini
Code2wd6.Dot requires certain information to operate.  A file is created that contains this information.  It is called Code2wd6.ini.


Control Structures
The macro will highlight the following control structures;

"If-Then Control Structure"

"Select Case Control Structure"

"While-Wend Control Structure"

"Do-Loop Control Structure"

"For-Next Control Structure"


Procedures
The macro will highlight the following procedures;

"Sub Routines"

"Functions"

"Begin-End Statements"


Declarations
The macro will highlight the following declaring variables;

"Type Statements"

"Declare Statements"

"Dim Statements"

"Global-Const Statements"


Normal Font
The Normal Font is the font that is used by the macro for all text that is not specifically highlighted by the macro.  It is also used for the page heading.


Embedded Keywords
Embedded Keywords are keywords that show up in statements other than the structure or statement that the macro has been designed to locate.  For example, if you are using the MsgBox statement or function, you might have a keyword within the message that you will be displaying.  This macro will highlight the keyword.  This can be undesirable depending on the number of embedded keywords your code module contains.  The macro looks for two embedded keywords, .Type and .Next.  If you set the embedded keyword font to the same font as your normal text, the macro will reverse any highlighting that has occurred for the above.  Keep in mind that the help file included with the registered version provides more detail to increase the functionality of this and other parts of the macro.


Default Windows Directory
The default windows directory is the directory where the windows executable files are located.  The important initialization files are in this directory, including Win.ini, System.ini and Winword6.ini.


Changing Initialization File

Changing Code2wd6.ini

If you would like to change the appearance of one of the structures within your document or would like to change the default settings of the template, select Change Code2wd6 Settings from the Format Menu.

Deleting Code2wd6.ini

If you are not happy with the format of the documents created with your selection of fonts, you can delete the initialization file Code2wd6.ini file from your default windows directory.  The macro will not be able to find Code2wd6.ini and will go through the initialization process again.

Adapt with Text Editor

The macro can be adapted for more structures, other languages and different fonts by editing the Code2wd6.ini file.  This process is explained more thoroughly in Adapting the Macro to other Structures/Languages.


Change Code2wd6 Settings

If you would like to change the appearance of one of the structures within your document or would like to change the default settings of the template, select Change Code2wd6 Settings from the Format Menu.  The following dialog box will appear.

Choose the item from the list that you would like to change and select the OK button.  The font dialog box will appear.  Select the font properties that you would like Code2wd6 to apply to that item when it reformats your Visual Basic™ code.  You will be given a choice to save the new settings to your default Code2wd6.ini file.  The macro will then proceed to reformat the document for the item selected.

Helpful Hint:  Before accessing Change Code2wd6 Settings from the Format Menu, place the cursor within the structure that you would like to change.  Choose the name of that structure from the list and choose the OK button.  When the font dialog box appears, it will show your current settings for that structure.


List Box
This is a list of control structures, procedures, declaring variables, and other items within your code module that are highlighted by Code2wd6.Dot.  To change the font settings for one of the items in the list, first select it with the mouse or the arrow keys and choose the OK button.  A Font Dialog box will appear so that you can choose a font, color, size, etc.


OK Button
Choose the OK button to change the font settings for the item selected in the list above.


Cancel Button
Choose the Cancel button to close the dialog box without changing any of the items in the list above.


Help Button
Choose the Help button to goto the Help module for Code2wd6.Dot.  If you do not exit the Help module (minimize instead of closing) and you select the Help button again, the Word for Windows title bar may flash.  To avoid this, exit the Help module before returning to Code2wd6.Dot.


Flashing Title Bar
To access Word for Windows when the title bar is flashing, double-click on the Word for Windows title bar or select the Word for Windows icon at the bottom of your screen.


Selecting a File

To use the template, choose the New command from the File Menu and select Code2wd6.

The first time you use the macro, an initialization process takes place.  Once this process is complete, a blank document will be opened and a dialog box will appear asking you to choose the form or code module to insert into the document.  You can load the file (must be a text file, not a binary file) from any directory or drive on your system.  Code2wd6 will then go to work.  The time to reformat the document is highly dependent on the size of the form or code module.


Binary File

Visual Basic™ can save files in binary and text format.  If a file is saved in binary format, a program must understand the structure of the file format to read the file.  This macro will not read a Visual Basic™ binary file.  You will get garbage on your screen if you attempt to insert a binary file.  See Visual Basic™ Default Settings to save your code in text format so that this macro can work as designed.


Visual Basic Default Settings
Visual Basic™ Default Settings

Visual Basic™ 3.0 can save files in binary or text format. To set the default setting so Visual Basic™ automatically saves the files in text format, open the Options menu and select Environment and change the Default Save As Format to Text.

If you want to keep Binary as the default setting, you can obtain a text file by using the Save File As command from the File menu and by checking Save as Text.


Saving Reformatted Code

The document created by Code2wd6.Dot can be saved just like any other Word for Windows 6.0 document.  Since your code module is inserted into a blank document, you will always be prompted to save the document.


Printing

The document created by Code2wd6.Dot can be printed just like any other Word for Windows 6.0 document.


Using Code2wd6 Help

During the initialization process, dialog boxes appear prompting you to select the appropriate font properties for a given structure.  Each of the dialog boxes has a Help button.  Selecting this button will start the Help module.

Once you have reformatted your code, you can start the Help module by selecting Code2wd6 Help from the Help Menu.


Using Different Fonts and Colors

This macro depends on your selection of fonts and colors to highlight the control structures, procedures, declaring variables, and comments. You should try to use as many different combinations of fonts and colors as your system allows.  Try to take advantage of the font properties available including Point Size, Bold, Italics, Small Caps,  and Underlining.

If you would like to change the appearance of one of the structures within your document or would like to change the default settings of the template, select Change Code2wd6 Settings from the Format Menu.


Using the Zoom Command

The Zoom command from the View Menu in Word for Windows 6.0 can be a useful debugging tool when used in conjunction with this macro.


Sample [Font Settings]

If you are having trouble finding a suitable combination of fonts for this macro, replace the [Font Settings] section of your Code2wd6.ini file with the one below.  If your system does not have some of these fonts, then replace the Font Name with one from your own system. (i.e. If you do not have Footlight MT Light, change it to Arial or one of your own choosing)

[Font Settings]

A=8,0,1,0,0,0,0,0 pt,0 pt,Arial,0,0

B=10,0,1,0,0,0,0,0 pt,0 pt,Times New Roman,1,1

C=10,0,10,0,0,0,0,0 pt,0 pt,Univers Condensed,1,0

D=10,0,12,0,0,0,0,0 pt,0 pt,Univers Condensed,1,0

E=10,0,14,0,0,0,0,0 pt,0 pt,Univers Condensed,1,0

F=10,0,13,0,0,0,0,0 pt,0 pt,Footlight MT Light,1,0

G=10,0,2,0,0,0,0,0 pt,0 pt,Arial,1,0

H=10,0,15,0,0,0,0,0 pt,0 pt,Arial,1,0

I=10,0,9,0,0,0,0,0 pt,0 pt,Arial,1,0

J=10,0,11,0,0,0,0,0 pt,0 pt,CG Times,1,0

K=10,0,11,0,0,0,0,0 pt,0 pt,CG Times,1,0

L=10,0,11,0,0,0,0,0 pt,0 pt,CG Times,1,0

M=10,0,11,0,0,0,0,0 pt,0 pt,CG Times,1,0

N=8,0,1,0,0,0,0,0 pt,0 pt,Times New Roman,0,0

O=8,0,6,0,0,0,0,0 pt,0 pt,Lucida Handwriting,0,1


Adapting the Macro to other Structures/Languages

This section of the Help module is included in the Registered Version.


Removing Code2wd6.Dot from your System

If you are not using Code2wd6.Dot and would like to remove it from your system, delete Code2wd6.Dot and Code2wd6.Hlp from your Word for Windows 6.0 template directory and Code2wd6.ini from your default windows directory.


Benefits of Registration

Code2wd6.Dot and all associated files are Shareware.  If you use Code2wd6.Dot regularly and find it to be of value, please use the Registration Form to receive the licensed version of the software.

With registration you will receive the Adapting the Macro to other Structures/Languages section of this help module.  It explains how to adapt the macro to your own programming style, how to add additional structures, and how to use the macro for other programming languages.


User Feedback

We hope that you find this template to be useful.  Please feel free to comment by E-Mail to Robert R. Jacques c/o Compuserve 71610,1255 or c/o Internet 71610.1255@compuserve.com.


Registration Form

Registration Fee:

The license fee is $15 (U.S. Dollars) or $20 (Canadian Dollars) per copy.

Make checks payable to Otium Corporation